package cn.jiyun.service.impl;

import cn.jiyun.entity.Yjqj;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.jiyun.entity.Yjjk;
import cn.jiyun.service.YjjkService;
import cn.jiyun.mapper.YjjkMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author 小九
* @description 针对表【yjjk】的数据库操作Service实现
* @createDate 2024-10-29 19:41:05
*/
@Service
public class YjjkServiceImpl extends ServiceImpl<YjjkMapper, Yjjk>
    implements YjjkService{

    @Autowired
    private YjjkMapper yjqjMapper;

    @Override
    public Page<Yjjk> findPage(Integer pageNum, Integer pageSize, Yjjk yjjk) {
        Page<Yjjk> yjjkPage = new Page<>(pageNum, pageSize);
        LambdaQueryWrapper<Yjjk> wrapper = new LambdaQueryWrapper<>();
        wrapper.like(yjjk.getName()!=null,Yjjk::getName,yjjk.getName());
        wrapper.like(yjjk.getSex()!=null,Yjjk::getSex,yjjk.getSex());
        wrapper.like(yjjk.getAddress()!=null,Yjjk::getAddress,yjjk.getAddress());
        wrapper.like(yjjk.getYjsj()!=null,Yjjk::getYjsj,yjjk.getYjsj());
        wrapper.like(yjjk.getYjlx()!=null,Yjjk::getYjlx,yjjk.getYjlx());
        Page page1=baseMapper.selectPage(yjjkPage,wrapper);
        return page1;
    }

    @Override
    public Yjjk findId(Integer id) {
        Yjjk yjjk = yjqjMapper.selectById(id);
        return yjjk;
    }

}




